﻿using System;

namespace SPSDeploy.Extensions.Controllers
{
    /// <summary>
    /// Base controller
    /// </summary>
    public abstract class BaseController
    {

        // Events
        public EventHandler<MessageEventArgs> ProgressMessage;

        /// <summary>
        /// Execute operation
        /// </summary>
        public abstract void Execute();

        /// <summary>
        /// Raise ProgressMessage event
        /// </summary>
        /// <param name="text"></param>
        internal void OnProgressMessage(string text)
        {
            if (ProgressMessage != null)
                ProgressMessage(this, new MessageEventArgs(MessageType.Information, text));
        }

        /// <summary>
        /// Raise ProgressMessage event
        /// </summary>
        /// <param name="type"></param>
        /// <param name="text"></param>
        internal void OnProgressMessage(MessageType type, string text)
        {
            if (ProgressMessage != null)
                ProgressMessage(this, new MessageEventArgs(type, text));
        }

    }
}